package com.lsp.server.common;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局异常处理
 *
 * @author
 * @version 1.0
 * @date 2021/10/18 11:00:34
 */
/*  aop 业务增强类     */
@ControllerAdvice //相当于 给所有的controller 加了一个异常通知
public class ControllerExcetptions {
    @ExceptionHandler
    @ResponseBody
    public Apiresponse chandlerException (Exception e){
        return Apiresponse.Error(500,e.getMessage());
    }
}
